#ifndef __COMM_CFG_PARAM_H__
#define __COMM_CFG_PARAM_H__

#include "comm/comm_base.h"
#include "comm/lib/tinyxml.h"

#include <iostream>
#include <list>
#include <vector>

using namespace std;

typedef struct {
    float tx;
    float ty;
    float tz;
    float roll;
    float pitch;
    float yaw;   
} CFG_PARAM_INSTALL_STRU;

typedef struct {
    float tx;
    float ty;
    float tz;  
} CFG_PARAM_INSTALL_POS_STRU;

typedef struct {
    float coeffY;
    float coeffZ;
    float constH;
} CFG_PARAM_PLANE_FIT_STRU;

typedef struct {
    BOOL                        isSupport;
    BOOL                        isDualAntenna;
    string                      strDevName;
    INT32                       baudRate;
    CFG_PARAM_INSTALL_STRU      stInstallPose;
} CFG_PARAM_GPS_STRU;

typedef struct {
    BOOL                   isSupport;
    string                 strDevName;
    INT32                  baudRate;
    BOOL                   isModifyGyroZ;
    CFG_PARAM_INSTALL_STRU stInstallPose;
} CFG_PARAM_IMU_STRU;

typedef struct {
    BOOL                        isSupport;
    CFG_PARAM_INSTALL_STRU stInstallPose;
} CFG_PARAM_LOC_LIDAR_STRU;

typedef struct {
    BOOL                        isSupport;
    CFG_PARAM_INSTALL_POS_STRU  stInstallPos;
    CFG_PARAM_PLANE_FIT_STRU    stPlaneFitParam;
} CFG_PARAM_HEAD_DEPTH_CAMERA_STRU;

typedef struct {
    BOOL                        isSupport;
    CFG_PARAM_INSTALL_POS_STRU  stInstallPos;
    CFG_PARAM_PLANE_FIT_STRU    stPlaneFitParam;
} CFG_PARAM_BACK_DEPTH_CAMERA_STRU;

typedef struct {
    BOOL                        isSupport;
    CFG_PARAM_INSTALL_STRU      stInstallPose;
} CFG_PARAM_LEFT_BACK_DEPTH_CAMERA_STRU;

typedef struct {
    BOOL                    isSupport;
    CFG_PARAM_INSTALL_STRU  stInstallPose;
} CFG_PARAM_RIGHT_BACK_DEPTH_CAMERA_STRU;

typedef struct {
    BOOL    isSupport;
    float   minDist;
    float   maxDist;
} CFG_PARAM_VISION_DETECT_OBJECT_STRU;

typedef struct {
    BOOL                                isSupport;
    CFG_PARAM_INSTALL_STRU              stInstallPose;
    CFG_PARAM_VISION_DETECT_OBJECT_STRU stDetPedCar;
    CFG_PARAM_VISION_DETECT_OBJECT_STRU stDetLane;
} CFG_PARAM_HEAD_WIDE_ANGLR_CAMERA_STRU;

typedef struct {
    BOOL                                isSupport;
    CFG_PARAM_INSTALL_STRU              stInstallPose;
    CFG_PARAM_VISION_DETECT_OBJECT_STRU stDetPedCar;
    CFG_PARAM_VISION_DETECT_OBJECT_STRU stDetLane;
} CFG_PARAM_BACK_WIDE_ANGLR_CAMERA_STRU;

typedef struct {
    BOOL                                isSupport;
    CFG_PARAM_INSTALL_STRU              stInstallPose;
    CFG_PARAM_VISION_DETECT_OBJECT_STRU stDetTrafficLight;
} CFG_PARAM_HEAD_LONG_FOCUS_CAMERA_STRU;

typedef struct {
    CFG_PARAM_HEAD_WIDE_ANGLR_CAMERA_STRU stHeadWideAngleCam;
    CFG_PARAM_BACK_WIDE_ANGLR_CAMERA_STRU stBackWideAngleCam;
    CFG_PARAM_HEAD_LONG_FOCUS_CAMERA_STRU stHeadLongFocusCam;
} CFG_PARAM_VISION_DETECT_STRU;

typedef struct {
    string  strIp;
    INT32   msopPort;
    INT32   difopPort;
    float   cutAngle;
    float   rpm;
    BOOL    isTimeSync;
} CFG_PARAM_RS_LIDAR_DEV_STRU;

typedef struct {
    INT32  startAngle;
    INT32  endAngle;
    float  minDist;
    float  maxDist;
    string resolution;
    INT32  intensityMode;
    string angleFileName;
    string channelFileName;
    string curvesFileName;
} CFG_PARAM_RS_LIDAR_DATA_STRU;

typedef struct {
    string                       strModel;
    string                       strFrameId;
    CFG_PARAM_RS_LIDAR_DEV_STRU  stDevParam;
    CFG_PARAM_RS_LIDAR_DATA_STRU stDataParam;
} CFG_PARAM_RS_LIDAR_DRIVER_STRU;

typedef struct {
    TRI_PRISM_STRU  stCarHeadFilterParam;
    CUBOID_STRU     stCarTailtopFilterParam;
    CUBOID_STRU     stCarTailbottomFilterParam;
} CFG_PARAM_HEAD_LIDAR_CAR_FILTER_STRU;

typedef struct {
    PYRAMID_STRU       stCarFilterParam;
    CUBOID_STRU        stLidarRackFilterParam;
} CFG_PARAM_MIDDLE_LIDAR_CAR_FILTER_STRU;

typedef struct {
    float startAngle;
    float endAngle;
} CFG_PARAM_LASER_SECTION_WIPE_STRU;

typedef struct {
    BOOL  isSupport;
    vector<CFG_PARAM_LASER_SECTION_WIPE_STRU>   vstLaserSectionWipe;
} CFG_PARAM_LIDAR_SECTION_WIPE_STRU;

typedef struct {
    BOOL  isSupport;
    CFG_PARAM_RS_LIDAR_DRIVER_STRU          stDriverParam;
    CFG_PARAM_INSTALL_STRU                  stInstallParam;
    CFG_PARAM_HEAD_LIDAR_CAR_FILTER_STRU    stCarFilterParam;
    CFG_PARAM_LIDAR_SECTION_WIPE_STRU       stLidarSectionWipe;
} CFG_PARAM_HEAD_LIDAR_STRU;

typedef struct {
    BOOL  isSupport;
    CFG_PARAM_RS_LIDAR_DRIVER_STRU          stDriverParam;
    CFG_PARAM_INSTALL_STRU                  stInstallParam;
    CFG_PARAM_MIDDLE_LIDAR_CAR_FILTER_STRU  stCarFilterParam;
    CFG_PARAM_LIDAR_SECTION_WIPE_STRU       stLidarSectionWipe;
}  CFG_PARAM_MIDDLE_LIDAR_STRU;

typedef struct {
    CFG_PARAM_HEAD_LIDAR_STRU    stHeadLeftRsBpearlLidar;
    CFG_PARAM_HEAD_LIDAR_STRU    stHeadRightRsBpearlLidar;
    CFG_PARAM_HEAD_LIDAR_STRU    stHeadLeftRs16Lidar;
    CFG_PARAM_MIDDLE_LIDAR_STRU  stMiddleRs16Lidar;
    CFG_PARAM_MIDDLE_LIDAR_STRU  stMiddleRsBpearlLidar;
} CFG_PARAM_LIDAR_STRU;

typedef struct {
    BOOL  isUseHeadLeftRs16Lidar;
    BOOL  isUseHeadRightRsBpearlLidar;
    BOOL  isUseHeadLeftRsBpearlLidar;
    BOOL  isUseMiddleRs16Lidar;
    BOOL  isUseMiddleRsBpearlLidar;
    BOOL  isUndistort;
} CFG_PARAM_MULTI_LIDAR_FUSION_STRU;

typedef struct{
    INT32  maxIter;
    float  stepSize;
    float  transEps;
    float  resolution;
} CFG_PARAM_NDT_MATCHER_STRU;

typedef struct {
    float minX;
    float maxX;
    float minY;
    float maxY;
    float minYaw;
    float maxYaw;   
} CFG_PARAM_SEARCH_REG_STRU;

typedef struct {
    float stepX;
    float stepY;
    float stepYaw;   
} CFG_PARAM_SEARCH_STEP_STRU;

typedef struct {
    CFG_PARAM_SEARCH_REG_STRU  stSearchRegion;
    CFG_PARAM_SEARCH_STEP_STRU stSearchStep;
} CFG_PARAM_RELOC_STRU;

typedef enum MATCH_METHOD_ENUM {
    NDT   = 0,
    ICP   = 1,
} MATCH_METHOD_ENUM;

typedef struct {
    MATCH_METHOD_ENUM          enMatchMethod;
    CFG_PARAM_NDT_MATCHER_STRU stNdtMatcher;
} CFG_PARAM_LIDAR_LOC_STRU;

typedef enum FUSION_METHOD_ENUM {
    MOVE_AVG_FILTER           =  0,
    ERROR_STATE_KALMAN_FILTER =  1,
} FUSION_METHOD_ENUM;

typedef struct {
    FUSION_METHOD_ENUM      enFusionMethod;
} CFG_PARAM_POSE_ESTIMATOR_STRU;

typedef struct {
    CFG_PARAM_POSE_ESTIMATOR_STRU  stPoseEstimator;
    CFG_PARAM_LIDAR_LOC_STRU       stLidarLoc;
    CFG_PARAM_RELOC_STRU           stReloc;
} CFG_PARAM_LOC_STRU;

typedef struct {
    BOOL    isSupportCluster;
    float   clusterRadius;
    float   outRadialVelThreshold;
} CFG_PARAM_RADAR_CLUSTER_STRU;

typedef struct {
    UINT32  devID;
    UINT32  maxObstCount;
    float   rightBottomPointX;
    float   rightBottomPointY;
    float   leftUpPointX;
    float   leftUpPointY;
} CFG_PARAM_RADAR_DETECT_STRU;

typedef struct {
    float tx;
    float ty;
    float roll;
    float yaw;   
} CFG_PARAM_RADAR_INSTALL_STRU;

typedef struct {
    BOOL                            isSupport;
    CFG_PARAM_RADAR_DETECT_STRU     stDetectParam;
    CFG_PARAM_RADAR_INSTALL_STRU    stInstallParam; 
} CFG_PARAM_RADAR_DEV_STRU;

typedef struct {
    CFG_PARAM_RADAR_CLUSTER_STRU    stClusterParam;
    CFG_PARAM_RADAR_DEV_STRU        stLeftRadar;
    CFG_PARAM_RADAR_DEV_STRU        stFrontRadar;
    CFG_PARAM_RADAR_DEV_STRU        stRightRadar;
    CFG_PARAM_RADAR_DEV_STRU        stBackRadar;
} CFG_PARAM_RADAR_STRU;

typedef struct {
    float       voxelSize;
    CUBOID_STRU stCuboid;
} CFG_PARAM_CAR_BODY_VXL_FILTER_SIZE_STRU;

typedef struct {
    BOOL                                        isSupport;
    CFG_PARAM_CAR_BODY_VXL_FILTER_SIZE_STRU     stFilterSize;
} CFG_PARAM_CAR_BODY_VXL_FILTER_STRU;

typedef struct {
    BOOL isSupport;
} CFG_PARAM_LIDAR_SHADOW_FILTER_STRU;

typedef struct CFG_PARAM_PCD_GROUND_SEG_STRU{
    INT32   scanPointsNum;
    float   resolution;
    float   maxLocalSlope;
    float   maxGeneralSlope;
    float   minHeightThreshold;
    float   reclassDistThreshold;
    float   radiusThreshold;
   
    CFG_PARAM_PCD_GROUND_SEG_STRU(INT32 num,float resol,float maxLocSlo,float maxSlo,float minThre,float reDis,float radius)
    {
        scanPointsNum           = num;
        resolution              = resol;
        maxLocalSlope           = maxLocSlo;
        maxGeneralSlope         = maxSlo;
        minHeightThreshold      = minThre;
        reclassDistThreshold    = reDis;
        radiusThreshold         = radius;
    }

    CFG_PARAM_PCD_GROUND_SEG_STRU()
    {
        scanPointsNum           = 0;
        resolution              = 0;
        maxLocalSlope           = 0;
        maxGeneralSlope         = 0;
        minHeightThreshold      = 0;
        reclassDistThreshold    = 0;
        radiusThreshold         = 0;
    }
} CFG_PARAM_PCD_GROUND_SEG_STRU;

typedef struct {
    BOOL isSuptBreakFeat;
    BOOL isSuptCornerFeat;
} CFG_PARAM_PCD_FEATURE_EXTR_STRU;

typedef struct {
    BOOL        isSupport;
    CUBOID_STRU stCuboid;
} CFG_PARAM_CONDITION_FILTER_STRU;

typedef struct {
    BOOL    isSupport;
    float   size;
} CFG_PARAM_VOXEL_GRID_FILTER_STRU;

typedef struct {
    BOOL    isSupport;
    float   searchRadius;
    INT32   minNeighbors;
} CFG_PARAM_RADIUS_OUTLIER_FILTER_STRU;

typedef struct {
    CFG_PARAM_CONDITION_FILTER_STRU         stConditionFilter;
    CFG_PARAM_VOXEL_GRID_FILTER_STRU        stVoxelGridFilter;
    CFG_PARAM_RADIUS_OUTLIER_FILTER_STRU    stRadiusOutlier;
} CFG_PARAM_PCD_FILTER_STRU;

typedef struct {
    float   min;
    float   max;
} CFG_PARAM_PCD_HEIGHT_STRU;

typedef struct {
    CFG_PARAM_PCD_HEIGHT_STRU  stUndergroundHeight;
    CFG_PARAM_PCD_HEIGHT_STRU  stGeneralHeight;
    CFG_PARAM_PCD_HEIGHT_STRU  stDangerHeight;
} CFG_PARAM_PCD_PARTITION_STRU;

typedef struct {
    float lengthX;
    float lengthY;
    float lengthZ;
} CFG_PARAM_DUSTBIN_BOX_STRU;

typedef struct {
    BOOL                        isSupport;
    float                       linkLength;
    CFG_PARAM_INSTALL_POS_STRU  stInstallPos;
    CFG_PARAM_DUSTBIN_BOX_STRU  stDustbinBox;
    CUBOID_STRU                 stDetRegion;
} CFG_PARAM_PCD_DUSTBIN_FILTER_STRU;

typedef struct {
    BOOL                                isSupport;
    RECTANGLE_STRU                      stVerifyReg;
} CFG_PARAM_DOUBLE_LIDAR_VERIFY_STRU;

typedef struct {
    BOOL            isSupport;
    RECTANGLE_STRU  stVerifyReg;
    float           CompareRadius;
    float           keyFrameDist;
} CFG_PARAM_EMERGENCE_VERIFY_STRU;

typedef struct {
    CFG_PARAM_DOUBLE_LIDAR_VERIFY_STRU  stDoubleLidarVerify;
    CFG_PARAM_EMERGENCE_VERIFY_STRU     stEmergenceVerify;
} CFG_PARAM_PCD_REFLECT_VERIFY_STRU;

typedef struct {
    BOOL isSupport;
} CFG_PARAM_PCD_SLOPE_PROC_STRU;

typedef struct {
    BOOL isSupport;
} CFG_PARAM_PCD_FALL_ARREST_STRU;

typedef struct {
    BOOL isSupport;
} CFG_PARAM_PCD_SHORT_OBST_HOLD_STRU;

typedef struct {
    BOOL isSupport;
} CFG_PARAM_PCD_IMPASS_AREA_DET_STRU;

typedef struct {
    float size;
} CFG_PARAM_VOEXL_GRID_STRU;

typedef struct {
    float   originDistance;
    float   clusterRadius;
    UINT32  minCluPointsNum;
    UINT32  maxCluPointsNum;
} CFG_PARAM_REGION_STRU;

typedef struct {
    BOOL    isSupport;
    float   minHeight;
    float   minLength;
    float   maxLength;
} CFG_PARAM_PCD_CLUSTER_CLASS_STRU;

typedef struct {
    bool    isSupport;
    float   maxLinearSpeed;
} CFG_PARAM_LINEAR_SPEED_LIMIT_STRU;

typedef struct {
    bool    isSupport;
    float   maxLinearAccSpeed;
} CFG_PARAM_LINEAR_ACC_SPEED_LIMIT_STRU;

typedef struct {
    bool    isSupport;
    float   maxAngularSpeed;
} CFG_PARAM_ANGULAR_SPEED_LIMIT_STRU;

typedef struct {
    bool    isSupport;
    float   boxBulkBiasRate;
} CFG_PARAM_BOX_BULK_BIAS_RATE_LIMIT_STRU;

typedef struct {
    CFG_PARAM_LINEAR_SPEED_LIMIT_STRU       stLinearSpeedLimit;
    CFG_PARAM_LINEAR_ACC_SPEED_LIMIT_STRU   stLinearAccSpeedLimit;
    CFG_PARAM_ANGULAR_SPEED_LIMIT_STRU      stAngularSpeedLimit;
    CFG_PARAM_BOX_BULK_BIAS_RATE_LIMIT_STRU stBoxBulkBiasRateLimit;
} CFG_PARAM_PCD_CLUSTER_SPEED_STRU;

typedef struct {
    BOOL    isSupport;
    CFG_PARAM_VOEXL_GRID_STRU               stVoxelGrid;
    vector<CFG_PARAM_REGION_STRU>           vstRegion;
    CFG_PARAM_PCD_CLUSTER_CLASS_STRU        stTruckDetect;
    CFG_PARAM_PCD_CLUSTER_CLASS_STRU        stCarDetect;
    CFG_PARAM_PCD_CLUSTER_CLASS_STRU        stManDetect;
    CFG_PARAM_PCD_CLUSTER_SPEED_STRU        stPcdClusterSpeed;
} CFG_PARAM_PCD_CLUSTER_STRU;

typedef struct {
    CFG_PARAM_CAR_BODY_VXL_FILTER_STRU  stCarBodyVxlFilter;
    CFG_PARAM_LIDAR_SHADOW_FILTER_STRU  stLidarShadowFilter;
    CFG_PARAM_PCD_FEATURE_EXTR_STRU     stPcdFeatureExtr;
    CFG_PARAM_PCD_GROUND_SEG_STRU       stPcdGroundSeg;
    CFG_PARAM_PCD_FILTER_STRU           stPcdFilter;
    CFG_PARAM_PCD_PARTITION_STRU        stPcdPartition;
    CFG_PARAM_PCD_DUSTBIN_FILTER_STRU   stPcdDustbinFilter;
    CFG_PARAM_PCD_SLOPE_PROC_STRU       stPcdSlopeProc;
    CFG_PARAM_PCD_FALL_ARREST_STRU      stPcdFallArrest;
    CFG_PARAM_PCD_REFLECT_VERIFY_STRU   stPcdReflectVerify;
    CFG_PARAM_PCD_SHORT_OBST_HOLD_STRU  stPcdShortObstHold;
    CFG_PARAM_PCD_IMPASS_AREA_DET_STRU  stPcdImpassAreaDet;
    CFG_PARAM_PCD_CLUSTER_STRU          stPcdCluster;
} CFG_PARAM_PCD_STRU;

typedef struct {
    float scaleFactor;
} CFG_PARAM_WHEEL_SPEED_SENSOR_STRU;

typedef struct {
    float scaleFactor;
    float offsetFactor;
} CFG_PARAM_STEERING_ANGLE_SENSOR_STRU;

typedef struct {
    float forwardAcc;
    float forwardDec;
    float backwardAcc;
    float backwardDec;
} CFG_PARAM_VEL_SMOOTHER_STRU;

typedef struct {
    CFG_PARAM_WHEEL_SPEED_SENSOR_STRU    stWheelSpeedSensor;
    CFG_PARAM_STEERING_ANGLE_SENSOR_STRU stSteeringAngleSensor;
    CFG_PARAM_VEL_SMOOTHER_STRU          stVelSmoother;
} CFG_PARAM_VEHICLE_CHASSIS_STRU;

typedef struct {
    float maxAngularVel;
    float smoothDec;
    float velCtrlDelayFactor;
} CFG_PARAM_LINEAR_VEL_PLAN_STRU;

typedef struct {
    CFG_PARAM_LINEAR_VEL_PLAN_STRU      stLinearVelPlan;
} CFG_PARAM_PLAN_STRU;

typedef struct {
    CFG_PARAM_GPS_STRU                          stGps;
    CFG_PARAM_IMU_STRU                          stImu;
    CFG_PARAM_LOC_LIDAR_STRU                    stLocLidar;
    CFG_PARAM_HEAD_DEPTH_CAMERA_STRU            stHeadDepthCamera;
    CFG_PARAM_BACK_DEPTH_CAMERA_STRU            stBackDepthCamera;
    CFG_PARAM_LEFT_BACK_DEPTH_CAMERA_STRU       stLeftBackDepthCamera;
    CFG_PARAM_RIGHT_BACK_DEPTH_CAMERA_STRU      stRightBackDepthCamera;
    CFG_PARAM_VISION_DETECT_STRU                stVisionDetect;
    CFG_PARAM_LIDAR_STRU                        stLidar;
    CFG_PARAM_MULTI_LIDAR_FUSION_STRU           stMultiLidarFusion;
    CFG_PARAM_LOC_STRU                          stLoc;
    CFG_PARAM_RADAR_STRU                        stRadar;
    CFG_PARAM_PCD_STRU                          stPcd;
    CFG_PARAM_VEHICLE_CHASSIS_STRU              stVehicleChassis;
    CFG_PARAM_PLAN_STRU                         stPlan;
} CFG_PARAM_STRU;

/**************************************************************************************
功能描述: 配置参数文件
修改记录:
**************************************************************************************/
class CFG_PARAM_FILE_C
{
public:
    INT32 Read(CFG_PARAM_STRU &stParam);
    INT32 Save(const CFG_PARAM_STRU &stParam);
    
private:
    TiXmlElement *GetFirstChildElement(TiXmlElement *pobjCfgParam, const char *element);
    TiXmlElement *GetNextSiblingElement(TiXmlElement *pobjCfgParam, const char *element);
    INT32 GetBoolAttributeValue(TiXmlElement *pobjCfgParam, const char *element, const char *attribute, BOOL &value);
    INT32 GetIntAttributeValue(TiXmlElement *pobjCfgParam, const char *element, const char *attribute, INT32 &value);
    INT32 GetUnsignedAttributeValue(TiXmlElement *pobjCfgParam, const char *element, const char *attribute, UINT32 &value);
    INT32 GetFloatAttributeValue(TiXmlElement *pobjCfgParam, const char *element, const char *attribute, float &value);
    INT32 ReadInstallParam(TiXmlElement *pobjCfgParam, const char *element, CFG_PARAM_INSTALL_STRU &stInstallPose);
    INT32 ReadInstallPosParam(TiXmlElement *pobjCfgParam, const char *element, CFG_PARAM_INSTALL_POS_STRU &stInstallPos);
    INT32 ReadDetectObjectParam(TiXmlElement *pobjCfgParam, const char *element, CFG_PARAM_VISION_DETECT_OBJECT_STRU &stDetectObj);
    
    INT32 ReadGpsCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_GPS_STRU &stGpsCfg);
    INT32 ReadImuCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_IMU_STRU &stImuCfg);
    INT32 ReadLocLidarCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_LOC_LIDAR_STRU &stLocLidarCfg);
    INT32 ReadPlaneFitParam(TiXmlElement *pobjCfgParam, const char *element, CFG_PARAM_PLANE_FIT_STRU &stPlaneFitParam);
    INT32 ReadHeadDepthCameraCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_HEAD_DEPTH_CAMERA_STRU &stHeadDepthCameraCfg);
    INT32 ReadBackDepthCameraCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_BACK_DEPTH_CAMERA_STRU &stBackDepthCameraCfg);
    INT32 ReadLeftBackDepthCameraCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_LEFT_BACK_DEPTH_CAMERA_STRU &stLeftBackDepthCameraCfg);
    INT32 ReadRightBackDepthCameraCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_RIGHT_BACK_DEPTH_CAMERA_STRU &stRightBackDepthCameraCfg);
    INT32 ReadVisionDetectCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_VISION_DETECT_STRU &stVisionDetectCfg);
    INT32 ReadLidarCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_LIDAR_STRU &stLidarCfg);
    INT32 ReadHeadLidarCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_HEAD_LIDAR_STRU &stHeadLidarCfg);
    INT32 ReadMiddleLidarCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_MIDDLE_LIDAR_STRU &stMiddleLidarCfg);
    INT32 ReadRsLidarDriverCfg(TiXmlElement *pobjRsLidarDriverCfg, CFG_PARAM_RS_LIDAR_DRIVER_STRU &stDriverCfg);
    INT32 ReadRsLidarDevCfg(TiXmlElement *pobjRsLidarDevCfg, CFG_PARAM_RS_LIDAR_DEV_STRU &stDevCfg);
    INT32 ReadRsLidarDataCfg(TiXmlElement *pobjRsLidarDataCfg, CFG_PARAM_RS_LIDAR_DATA_STRU &stDataCfg);
    INT32 ReadRsLidarInstallCfg(TiXmlElement *pobjRsLidarInstallCfg, CFG_PARAM_INSTALL_STRU &stInstallCfg);
    INT32 ReadHeadRsLidarCarFilterCfg(TiXmlElement *pobjRsLidarCarFilterCfg, CFG_PARAM_HEAD_LIDAR_CAR_FILTER_STRU &stCarFilterCfg);
    INT32 ReadMiddleRsLidarCarFilterCfg(TiXmlElement *pobjRsLidarCarFilterCfg, CFG_PARAM_MIDDLE_LIDAR_CAR_FILTER_STRU &stCarFilterCfg);
    INT32 ReadLaserSectionWipeCfg(TiXmlElement *pobjSection, const char *element, CFG_PARAM_LASER_SECTION_WIPE_STRU &stLaserSectionWipe);
    INT32 ReadRsLidarSectionWipeCfg(TiXmlElement *pobjRsLidarSectionWipeCfg, const char *element, CFG_PARAM_LIDAR_SECTION_WIPE_STRU &stLidarSectionWipe);
    INT32 ReadTriangularPrismCfg(TiXmlElement *pobjTriangularPrismCfg, TRI_PRISM_STRU &stTriangularPrism);
    INT32 ReadCuboidCfg(TiXmlElement *pobjCuboidrCfg, CUBOID_STRU &stCuboid);
    INT32 ReadPyramidCfg(TiXmlElement *pobjPyramidCfg, PYRAMID_STRU &stPyramid);
    INT32 ReadMultiLidarFusionCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_MULTI_LIDAR_FUSION_STRU &stMultiLidarFusionCfg);
    INT32 ReadLocalizationCfg(TiXmlElement  *pobjCfgParam, CFG_PARAM_LOC_STRU &stLocCfg);
    INT32 ReadPoseEstimatorCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_POSE_ESTIMATOR_STRU &stPoseEstimator);
    INT32 ReadLidarLocCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_LIDAR_LOC_STRU &stLidarLocCfg);
    INT32 ReadNdtMatcherCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_NDT_MATCHER_STRU &stNdtMatcherCfg);
    INT32 ReadReLocalizationCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_RELOC_STRU &stReLocCfg);
    INT32 ReadSearchRegionCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_SEARCH_REG_STRU &stSearchRegCfg);
    INT32 ReadSearchStepCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_SEARCH_STEP_STRU &stSearchStepCfg);

    INT32 ReadRadarDevCfg(TiXmlElement *pobjCfgParam, const char *element, CFG_PARAM_RADAR_DEV_STRU &stRadarDevCfg);
    INT32 ReadRadarCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_RADAR_STRU &stRadar);

    INT32 ReadCarBodyVxlFilterCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_CAR_BODY_VXL_FILTER_STRU &stCarBodyVxlFilter);
    INT32 ReadLidarShadowFilterCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_LIDAR_SHADOW_FILTER_STRU &stLidarShadowFilter);
    INT32 ReadPcdFeatureExtrCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_FEATURE_EXTR_STRU &stPcdFeatureExtr);
    INT32 ReadPcdGroundSegCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_GROUND_SEG_STRU &stPcdGroundSeg);
    INT32 ReadPcdFilterCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_FILTER_STRU &stPcdFilter);
    INT32 ReadPcdHeightCfg(TiXmlElement *pobjCfgParam, const char *element, CFG_PARAM_PCD_HEIGHT_STRU &stPcdHeight);
    INT32 ReadPcdPartitionCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_PARTITION_STRU &stPcdPartition);
    INT32 ReadDustbinInstallCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_INSTALL_POS_STRU &stInstallPos);
    INT32 ReadDustbinBoxCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_DUSTBIN_BOX_STRU &stDustbinBox);
    INT32 ReadDustbinDetRegionCfg(TiXmlElement *pobjCfgParam, CUBOID_STRU &stDetRegion);
    INT32 ReadDustbinLinkCfg(TiXmlElement *pobjCfgParam, float &linkLength);
    INT32 ReadPcdDustbinFilterCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_DUSTBIN_FILTER_STRU &stPcdDustbinFilter);
    INT32 ReadPcdReflectRegionCfg(TiXmlElement *pobjCfgParam, const char *element, RECTANGLE_STRU &stVerifyReg);
    INT32 ReadPcdDoubleLidarReflectVerifyCfg(TiXmlElement *pobjCfgParam, const char *element, CFG_PARAM_DOUBLE_LIDAR_VERIFY_STRU &stReflectVerify);
    INT32 ReadPcdEmergenceReflectVerifyCfg(TiXmlElement *pobjCfgParam, const char *element, CFG_PARAM_EMERGENCE_VERIFY_STRU &stReflectVerify);
    INT32 ReadPcdReflectVerifyCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_REFLECT_VERIFY_STRU &stPcdReflectVerify);
    INT32 ReadPcdSlopeProcCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_SLOPE_PROC_STRU &stPcdSlopeProc);
    INT32 ReadPcdFallArrestCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_FALL_ARREST_STRU &stPcdFallArrest);
    INT32 ReadPcdShortObstHoldCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_SHORT_OBST_HOLD_STRU  &stPcdShortObstHold);
    INT32 ReadPcdImpassAreaDetCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_IMPASS_AREA_DET_STRU  &stPcdImpassAreaDet);
    INT32 ReadPcdRegionCfg(TiXmlElement *pobjCfgParam, const char *element, CFG_PARAM_REGION_STRU &stRegion);
    INT32 ReadPcdClusterClassCfg(TiXmlElement *pobjCfgParam, const char *element, CFG_PARAM_PCD_CLUSTER_CLASS_STRU &stPcdClusterClass);
    INT32 ReadPcdClusterCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_CLUSTER_STRU &stPcdCluster);
    INT32 ReadPcdCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PCD_STRU &stPcdParam);
    
    INT32 ReadWheelSpeedSensorCfg(TiXmlElement *pobjVehicleChassisCfgParam, CFG_PARAM_WHEEL_SPEED_SENSOR_STRU &stWheelSpeedSensorCfg) const;
    INT32 ReadSteeringAngleSensorCfg(TiXmlElement *pobjVehicleChassisCfgParam, CFG_PARAM_STEERING_ANGLE_SENSOR_STRU &stSteeringAngleSensorCfg) const;
    INT32 ReadVelSmootherCfg(TiXmlElement *pobjVehicleChassisCfgParam, CFG_PARAM_VEL_SMOOTHER_STRU &stVelSmootherCfg) const;
    INT32 ReadVehicleChassisCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_VEHICLE_CHASSIS_STRU &stVehicleChssisCfg) const;

    INT32 ReadLinearVelPlanCfg(TiXmlElement *pobjPlanCfgParam, CFG_PARAM_LINEAR_VEL_PLAN_STRU &stLinearVelPlanCfg) const;
    INT32 ReadPlanCfg(TiXmlElement *pobjCfgParam, CFG_PARAM_PLAN_STRU &stPlanCfg) const;
    
};

/**************************************************************************************
功能描述: 配置参数
修改记录:
**************************************************************************************/
class CFG_PARAM_C
{
public:
    INT32 Init(void);

    BOOL  IsSupportGps(void);
    BOOL  IsGpsDualAntenna(void);

    BOOL  IsSupportImu(void);
    BOOL  IsSupportLocLidar(void);

    BOOL  IsSupportHeadDepthCamera(void);
    BOOL  IsSupportBackDepthCamera(void);
    BOOL  IsSupportLeftBackDepthCamera(void);
    BOOL  IsSupportRightBackDepthCamera(void);
    
    BOOL  IsSupportVisionDetectMan(void);
    BOOL  IsSupportVisionDetectCar(void);
    BOOL  IsSupportVisionDetectLane(void);
    BOOL  IsSupportVisionDetectTrafficLight(void);

    BOOL  IsSupportHeadLeftRs16Lidar(void);
    BOOL  IsSupportHeadLeftRsBpearlLidar(void);
    BOOL  IsSupportHeadRightRsBpearlLidar(void);
    BOOL  IsSupportMiddleRs16Lidar(void);
    BOOL  IsSupportMiddleRsBpearlLidar(void);

    CFG_PARAM_HEAD_LIDAR_STRU   GetHeadLeftRs16LidarParam(void);
    CFG_PARAM_HEAD_LIDAR_STRU   GetHeadLeftRsBpearlLidarParam(void);
    CFG_PARAM_HEAD_LIDAR_STRU   GetHeadRightRsBpearlLidarParam(void);
    CFG_PARAM_MIDDLE_LIDAR_STRU GetMiddleRs16LidarParam(void);
    CFG_PARAM_MIDDLE_LIDAR_STRU GetMiddleRsBpearlLidarParam(void);

    BOOL  IsUseHeadLeftRs16Lidar(void);
    BOOL  IsUseHeadLeftRsBpearlLidar(void);
    BOOL  IsUseHeadRightRsBpearlLidar(void);
    BOOL  IsUseMiddleRs16Lidar(void);
    BOOL  IsUseMiddleRsBpearlLidar(void);
    BOOL  IsUndistort(void);

    BOOL  IsSupportLeftRadar(void);
    BOOL  IsSupportFrontRadar(void);
    BOOL  IsSupportRightRadar(void);
    BOOL  IsSupportBackRadar(void);

    BOOL  IsSupportCarBodyVxlFilter(void);
    BOOL  IsSupportLidarShadowFilter(void);
    BOOL  IsSupportPcdBreakFeatureExtr(void);
    BOOL  IsSupportPcdCornerFeatureExtr(void);
    BOOL  IsSupportPcdDustbinFilter(void);
    BOOL  IsSupportPcdConditionFilter(void);
    BOOL  IsSupportPcdVoexlGridFilter(void);   
    BOOL  IsSupportPcdRadiusOutlierFilter(void);
    BOOL  IsSupportDoubleLidarReflectVerify(void);
    BOOL  IsSupportEmergenceReflectVerify(void);
    BOOL  IsSupportPcdSlopeProc(void);
    BOOL  IsSupportPcdFallArrest(void);
    BOOL  IsSupportPcdShortObstHold(void);
    BOOL  IsSupportPcdImpassAreaDet(void);
    BOOL  IsSupportPcdCluster(void);

    string GetGpsDevName(void)    const;
    INT32  GetGpsBaudRate(void)   const;
    
    string GetImuDevName(void)    const;
    INT32  GetImuBaudRate(void)   const;
    BOOL   IsModifyImuGyroZ(void) const;

    CFG_PARAM_INSTALL_STRU               &GetGpsInstallPose(void) const;
    CFG_PARAM_INSTALL_STRU               &GetImuInstallPose(void) const;
    CFG_PARAM_INSTALL_STRU               &GetLocLidarInstallPose(void) const;
    CFG_PARAM_INSTALL_POS_STRU           &GetHeadDepthCameraInstallCfg(void) const;
    CFG_PARAM_INSTALL_POS_STRU           &GetBackDepthCameraInstallCfg(void) const;
    CFG_PARAM_INSTALL_STRU               &GetLeftBackDepthCameraInstallCfg(void) const;
    CFG_PARAM_INSTALL_STRU               &GetRightBackDepthCameraInstallCfg(void) const;

    CFG_PARAM_PLANE_FIT_STRU             &GetHeadDepthCameraPlaneFitCfg(void) const;
    CFG_PARAM_PLANE_FIT_STRU             &GetBackDepthCameraPlaneFitCfg(void) const;

    CFG_PARAM_RADAR_STRU                 &GetRadarCfg(void) const;

    CFG_PARAM_CAR_BODY_VXL_FILTER_STRU   &GetCarBodyVxlFilterCfg(void) const;
    CFG_PARAM_LIDAR_SHADOW_FILTER_STRU   &GetLidarShadowFilter(void) const;
    CFG_PARAM_PCD_FEATURE_EXTR_STRU      &GetPcdFeatureExtrCfg(void) const;
    CFG_PARAM_PCD_GROUND_SEG_STRU        &GetPcdGroundSegCfg(void) const;
    CFG_PARAM_PCD_FILTER_STRU            &GetPcdFilterCfg(void) const;
    CFG_PARAM_CONDITION_FILTER_STRU      &GetPcdConditionFilter(void) const;
    CFG_PARAM_VOXEL_GRID_FILTER_STRU     &GetPcdVoexlGridFilter(void) const;   
    CFG_PARAM_RADIUS_OUTLIER_FILTER_STRU &GetPcdRadiusOutlierFilter(void) const;
    CFG_PARAM_PCD_PARTITION_STRU         &GetPcdPartitionCfg(void) const;
    CFG_PARAM_PCD_DUSTBIN_FILTER_STRU    &GetPcdDustbinFilterCfg(void) const;
    CFG_PARAM_DOUBLE_LIDAR_VERIFY_STRU   &GetDoubleLidarReflectVerifyCfg(void) const;
    CFG_PARAM_EMERGENCE_VERIFY_STRU      &GetEmergenceReflectVerifyCfg(void) const;
    CFG_PARAM_PCD_SLOPE_PROC_STRU        &GetPcdSlopeProcCfg(void) const;
    CFG_PARAM_PCD_FALL_ARREST_STRU       &GetPcdFallArrestCfg(void) const;
    CFG_PARAM_PCD_SHORT_OBST_HOLD_STRU   &GetPcdShortObstHoldCfg(void) const;
    CFG_PARAM_PCD_IMPASS_AREA_DET_STRU   &GetPcdImpassAreaDet(void) const;
    CFG_PARAM_PCD_CLUSTER_STRU           &GetPcdClusterCfg(void) const;

    CFG_PARAM_INSTALL_STRU               &GetHeadWideAngleCameraInstallCfg(void) const;
    CFG_PARAM_INSTALL_STRU               &GetBackWideAngleCameraInstallCfg(void) const;
    CFG_PARAM_INSTALL_STRU               &GetHeadLongFocusCameraInstallCfg(void) const;

    CFG_PARAM_VISION_DETECT_OBJECT_STRU  &GetHeadWideAngleCamPedCarParam(void) const;
    CFG_PARAM_VISION_DETECT_OBJECT_STRU  &GetBackWideAngleCamPedCarParam(void) const;
    CFG_PARAM_VISION_DETECT_OBJECT_STRU  &GetHeadWideAngleCamLaneParam(void) const;
    CFG_PARAM_VISION_DETECT_OBJECT_STRU  &GetBackWideAngleCamLaneParam(void) const;
    CFG_PARAM_VISION_DETECT_OBJECT_STRU  &GetHeadLongFocusCamTrafficLightParam(void) const;
    
    CFG_PARAM_WHEEL_SPEED_SENSOR_STRU    &GetWheelSpeedSensorCfg(void) const;
    CFG_PARAM_STEERING_ANGLE_SENSOR_STRU &GetSteeringAngleSensorCfg(void) const;
    CFG_PARAM_VEL_SMOOTHER_STRU          &GetVelSmootherCfg(void) const;

    const CFG_PARAM_LINEAR_VEL_PLAN_STRU &GetLinearVelPLanCfg(void) const;

    FUSION_METHOD_ENUM                   &GetFusionMethod(void) const;
    
    MATCH_METHOD_ENUM                    &GetLidarLocMatchMethod(void) const;
    CFG_PARAM_NDT_MATCHER_STRU           &GetLidarLocNdtCfg(void) const;

    CFG_PARAM_LOC_STRU                   &GetLocCfg(void) const;
    CFG_PARAM_SEARCH_REG_STRU            &GetReLocSearchRegion(void) const;
    CFG_PARAM_SEARCH_STEP_STRU           &GetReLocSearchStep(void) const;
    
private:
    static BOOL           isInitSucc_;
    static CFG_PARAM_STRU stCfgParam_;
};

#endif

